# Destinations Configuration

Each destination is represented by YAML node of `destinations` section in the configuration file

```yaml
destinations:
  destination_name1:
    type: postgres | snowflake | redshift | s3 | bigquery | clickhouse | mysql | google_analytics | facebook | amplitude | hubspot
    mode: stream | batch #Optional. Default value is 'batch'
    only_tokens: [] #Optinal. Default value is array with all authorization tokens
    staged: true | false #Optional. Default value is false
    data_layout: #Optional
      table_name_template: $.event_type #Optional. Default value is 'events'
      mappings: #Optional. See documentation link below
        ...
      primary_key_fields: [] #Optional. See documentation link below
    enrichment: #Optional. See below for details
      - rule1: #rule 1
      - rule2: #rule 1
    log: #Optional. See documentation link below
      ...
    users_recognition: #Optional. Overrides global configuration. See documentation link below
      ...

  destination_name2: ...
```

Except that, destination-specific parameters (usually, connection credentials) should be present.
Please, see individual destination configuration pages (see full list below).

Please set up a destination name (`destination_name1` in the example) carefully.
This value will be treated as id in multiple places (monitoring counters, logs, folder names) and should not be changed

Following parameters are common for all destination types

<table>
  <thead>
    <tr>
      <th>
        Parameter<br />(** required)
      </th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <b>type **</b>
      </td>
      <td>One of supported destination types</td>
    </tr>
    <tr>
      <td>
        <b>mode </b>
      </td>
      <td>
        <code inline="true">batch</code> or <code inline="true">stream</code>.
        Use batch for highloaded datasets (&gt;10 events per second) and stream
        for others. Default value is <code inline="true">batch</code>
      </td>
    </tr>
    <tr>
      <td>
        <b>only_tokens </b>
      </td>
      <td>
        List of authorization tokens (secrets) ids. It is used for delimiting
        data from different tokens to different destinations. Please, see{" "}
        <a href="/docs/configuration/authorization">Authorization section</a>.
        Please, put token <b>id </b>rather then client/server secret. Default
        value is all authorization tokens
      </td>
    </tr>
    <tr>
      <td>
        <b>data_layout.mappings</b>
      </td>
      <td>
        Optional parameter to configure the mapping. See{" "}
        <a href="/docs/configuration/schema-and-mappings">
          Schema and Mappings
        </a>
      </td>
    </tr>
    <tr>
      <td>
        <b>data_layout.primary_key_fields</b>
      </td>
      <td>
        Optional parameter to configure primary key (works for PostgresSQL and
        Redshift so far). See{" "}
        <a href="/docs/configuration/primary-keys-configuration">
          Primary keys configuration
        </a>
      </td>
    </tr>
    <tr>
      <td>
        <b>data_layout.table_name_template</b>
      </td>
      <td>
        Name of the destination table. Can be either constant string (all events
        will be written in a single table) or expression in{" "}
        <a href="https://golang.org/pkg/text/template/#hdr-Actions">
          go template language
        </a>
        . The subject of expression is the event JSON. Example:
        <code inline="true">{"data_{{.event_type}}"}</code>
      </td>
    </tr>
    <tr>
      <td>
        <b>enrichment</b>
      </td>
      <td>
        Data Enrichment rules configuration. See{" "}
        <a href="/docs/configuration/enrichment-rules">Enrichment Rules</a> page
      </td>
    </tr>
    <tr>
      <td>
        <b>staged </b>
      </td>
      <td>
        If set to true, data won't be stored at the destination. Only{" "}
        <a href="/docs/other-features/dry-run-events">dry run operation</a> is
        supported for staged destinations
      </td>
    </tr>
  </tbody>
</table>

### Configuring destinations via HTTP - endpoint

If destinations configuration is generated by an external service, it is possible to externalize via HTTP end - point \(or file\) as follows:

```yaml
destinations: "location"
```

The location can be`http(s)://` of a local file \(`/path/to/file`\) location and should contain YAML or \(JSON that is identical to YAML structure\). If the location is an URL, the client will respect `If-Modified-Since` / `Last-Modified` caching.

Example of URL content:

```json
{
  "destinations": { #json object where inner keys - destinations unique names
    "redshift_dab213ibda": { #destination config object
      "type": "redshift",
      ...
    },
    "clickhouse_in31o31": {
      "type": "clickhouse",
      ...
    }
  }
}
```

## All supported destinations

### Databases

<LargeLink
  href="/docs/destinations-configuration/snowflake"
  title="Snowflake"
/>

<LargeLink href="/docs/destinations-configuration/s3" title="AWS S3" />

<LargeLink
  href="/docs/destinations-configuration/redshift"
  title="AWS RedShift"
/>

<LargeLink href="/docs/destinations-configuration/postgres" title="Postgres" />

<LargeLink
  href="/docs/destinations-configuration/bigquery"
  title="Google BigQuery"
/>

<LargeLink
  href="/docs/destinations-configuration/clickhouse-destination"
  title="Clickhouse"
/>

<LargeLink href="/docs/destinations-configuration/mysql" title="MySQL" />

### Services

<LargeLink
  href="/docs/destinations-configuration/amplitude"
  title="Amplitude"
/>

<LargeLink href="/docs/destinations-configuration/hubspot" title="HubSpot" />

<LargeLink
  href="/docs/destinations-configuration/google-analytics"
  title="Google Analytics"
/>

<LargeLink
  href="/docs/destinations-configuration/facebook-conversion-api"
  title="Facebook Conversion (Pixel) API"
/>

<LargeLink href="/docs/destinations-configuration/webhook" title="WebHook" />
